package com.foreknow.demo2;

import java.util.Scanner;

public class LoopDemo1 {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        //商品名
        String name = "";
        //商品价格
        double price = 0.0;
        //商品编号
        int goodsNo = 0;
        System.out.println("*********");
        System.out.println("请选择购买商品编号：");
        System.out.println("1.Fender     2.Gibson      3.Yamaha");
        System.out.println("*********");
        String answer = "y";
        while ("y".equals(answer)){
            System.out.println("请输入商品编号：");
            goodsNo = input.nextInt();
            switch (goodsNo){
                case 1:
                    name = "Fender";
                    price  = 21000.0;
                    break;
                case 2:
                    name = "Gibson";
                    price = 31000.0;
                    break;
                case 3:
                    name = "Yamaha";
                    price = 11000.0;
                    break;
            }
            System.out.println(name+"------"+price);
            System.out.println("是否继续(y/n)");
            answer = input.next();
        }
        System.out.println("继续执行循环后的代码。。。。。");


    }
}
